package com.keray.web.push.worker;


import com.keray.web.push.ClientData;
import com.keray.web.push.ClientMessageData;
import com.keray.web.push.MessageType;

import javax.websocket.Session;

/**
 * @author by keray
 * date:2021/7/23 9:53 上午
 */
public interface SocketWorker {
    MessageType activeType();

    default void onOpen(Session session, ClientData data) {

    }

    default void onClose(Session session, ClientData data) {

    }

    default void onMessage(String message, Session session, ClientData data) {

    }

    default void onError(Session session, Throwable error, ClientData data) {

    }

    default ClientMessageData onSend(ClientMessageData messageData) {
        return messageData;
    }

    default void onSendOk(ClientMessageData messageData) {

    }
}
